package com.wltt.product.ahuthr.controller;

import com.wltt.product.ahuthr.model.ResultData;
import com.wltt.product.ahuthr.model.UserBasicStartSalaryReq;
import com.wltt.product.ahuthr.model.vo.*;
import com.wltt.product.ahuthr.service.UserBasicService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping(value = "/api/userBasic")
public class UserBasicController {

    @Resource
    private UserBasicService userBasicService;

    /**
     * 分页查询
     *
     * @return
     */
    @RequestMapping(value = {"/listUserBasic"}, method = RequestMethod.POST)
    public ResultData listUserBasic(@RequestBody ListUserBasicReq listUserBasicReq) {
        return userBasicService.listUser(listUserBasicReq);
    }

    /**
     * 分页查询登记列表
     *
     * @return
     */
    @RequestMapping(value = {"/listUserBasicRegister"}, method = RequestMethod.POST)
    public ResultData listUserBasicRegister(@RequestBody ListUserBasicRegisterReq req) {
        return userBasicService.listUserBasicRegister(req);
    }

    /**
     * 分页查询起薪列表
     *
     * @return
     */
    @RequestMapping(value = {"/listUserBasicStartSalary"}, method = RequestMethod.POST)
    public ResultData listUserBasicStartSalary(@RequestBody ListUserBasicStartSalaryReq listUserBasicStartSalaryReq) {
        return userBasicService.listUserBasicStartSalary(listUserBasicStartSalaryReq);
    }

    /**
     * 分页查询审核列表
     *
     * @return
     */
    @RequestMapping(value = {"/listUserBasicAudit"}, method = RequestMethod.POST)
    public ResultData listUserBasicAudit(@RequestBody ListUserBasicAuditReq req) {
        return userBasicService.listUserBasicAudit(req);
    }

    /**
     * 导出
     *
     * @return
     */
    @RequestMapping(value = {"/exportUserBasic"}, method = RequestMethod.GET)
    public void exportUserBasic(@RequestParam(value = "deptId", required = false) Long deptId,
                                @RequestParam(value = "userName", required = false) String userName,
                                @RequestParam(value = "userIdNumber", required = false) String userIdNumber,
                                @RequestParam(value = "jobNumber", required = false) String jobNumber,
                                HttpServletResponse response) {
        userBasicService.exportUserBasic(deptId, userName, userIdNumber, jobNumber, response);
    }

    /**
     * 详情
     *
     * @return
     */
    @RequestMapping(value = {"/userBasicDetail"}, method = RequestMethod.POST)
    public ResultData userBasicDetail(@RequestBody UserBasicDetailReq userBasicDetailReq) {
        return userBasicService.userBasicDetail(userBasicDetailReq);
    }

    /**
     * 简单详情
     *
     * @return
     */
    @RequestMapping(value = {"/userSimpleDetail"}, method = RequestMethod.POST)
    public ResultData userSimpleDetail(@RequestBody UserSimpleDetailReq userSimpleDetailReq) {
        return userBasicService.userSimpleDetail(userSimpleDetailReq);
    }

    /**
     * 提交
     *
     * @return
     */
    @RequestMapping(value = {"/submitUserBasic"}, method = RequestMethod.POST)
    public ResultData submitUserBasic(@RequestBody SubmitUserBasicReq submitUserBasicReq) {
        return userBasicService.submitUserBasic(submitUserBasicReq);
    }

    /**
     * 更新
     *
     * @return
     */
    @RequestMapping(value = {"/updateUserBasic"}, method = RequestMethod.POST)
    public ResultData updateUserBasic(@RequestBody UpdateUserBasicReq userBasicDetailReq) {
        return userBasicService.updateUserBasic(userBasicDetailReq);
    }

    /**
     * 新增
     *
     * @return
     */
    @RequestMapping(value = {"/addUserBasic"}, method = RequestMethod.POST)
    public ResultData addUserBasic(@RequestBody AddUserBasicReq addUserBasicReq) {
        return userBasicService.addUserBasic(addUserBasicReq);
    }

    /**
     * 删除
     *
     * @return
     */
    @RequestMapping(value = {"/deleteUserBasic"}, method = RequestMethod.POST)
    public ResultData deleteUserBasic(@RequestBody DeleteUserBasicReq deleteUserBasicReq) {
        return userBasicService.deleteUserBasic(deleteUserBasicReq);
    }

    /**
     * 查询聘期考核人员
     *
     * @return
     */
    @RequestMapping(value = {"/queryForEmploymentExamine"}, method = RequestMethod.POST)
    public ResultData queryForEmploymentExamine(@RequestBody QueryForEmploymentExamineReq queryForEmploymentExamineReq) {
        return userBasicService.queryForEmploymentExamine(queryForEmploymentExamineReq);
    }

    /**
     * 审核
     *
     * @return
     */
    @RequestMapping(value = {"/auditUserBasicRegister"}, method = RequestMethod.POST)
    public ResultData auditUserBasicRegister(@RequestBody AuditUserBasicRegisterReq auditUserBasicRegisterReq) throws IOException {
        return userBasicService.auditUserBasicRegister(auditUserBasicRegisterReq);
    }

    /**
     * 人员起薪
     *
     * @return
     */
    @RequestMapping(value = {"/userBasicStartSalary"}, method = RequestMethod.POST)
    public ResultData userBasicStartSalary(@RequestBody UserBasicStartSalaryReq userBasicStartSalaryReq) throws IOException {
        return userBasicService.userBasicStartSalary(userBasicStartSalaryReq);
    }
}
